package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：石破天
 * @date ：Created in 2022年06月07日
 * @description ：
 * @version: 1.0
 */
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
public class MobileSetMealController {
    @Autowired
   private SetMealService setMealService;


    @GetMapping("/findById")
    public Result findById(Integer id){
        Setmeal setmeal = setMealService.findById(id);
        return new Result(true,MessageConst.GET_SETMEAL_LIST_SUCCESS,setmeal);
    }
    @GetMapping("/getSetmeal")
    public Result listFindAll() {
        log.info("[手机端-查询全部套餐]data:{}");
        List<Setmeal> setmeals = setMealService.listAll();
        return new Result(true, MessageConst.GET_SETMEAL_LIST_SUCCESS, setmeals);
    }
}
